<template>
  <div class="top-nav">
    <div class="nav-content">
      <div class="logo">
        <el-avatar size="small" style="background:#e0e7ff;color:#7e57c2;">PO</el-avatar>
      </div>
      <div class="search">
        <el-input placeholder="请输入文本" size="small" prefix-icon="el-icon-search" />
      </div>
      <div class="nav-links">
        <router-link to="/" class="nav-item">首页</router-link>
        <router-link to="/data" class="nav-item">数据仓库</router-link>
        <router-link to="/model" class="nav-item">模型库</router-link>
        <router-link to="/community" class="nav-item">社区</router-link>
        <router-link to="/projects" class="nav-item projects-item">我的项目</router-link>
      </div>
      <div class="user-avatar">
        <el-avatar size="small" style="background:#7e57c2;">PO</el-avatar>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRoute } from 'vue-router'
const route = useRoute()
</script>

<style scoped>
.nav-links {
  display: flex;
  align-items: center;
  flex-grow: 1;
  justify-content: flex-end;
}

.nav-group {
  display: flex;
  gap: 0;
}

.nav-item {
  padding: 0 24px;
  font-size: 16px;
  color: #000;
  text-decoration: none;
  height: 60px;
  line-height: 60px;
  white-space: nowrap;
  /* 防止换行 */
}

.nav-item.active {
  color: #7e57c2;
  font-weight: bold;
  /* 保持活动状态突出显示 */
}

/* 移除.projects-item特殊样式 */

/* 保留其他现有样式不变 */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #9575cd;
  /* 浅紫色 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.nav-content {
  display: flex;
  align-items: center;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.logo {
  margin-right: 20px;
}

.search {
  flex: 2;
  /* 宽度比例调整为2倍 */
  max-width: 800px;
  /* 最大宽度翻倍 */
  margin-right: 20px;
}

.user-avatar {
  margin-left: 20px;
}
</style>